const { Menu, dialog } = require('electron');
const mainMenu = (ars, cb) => {
    return Menu.buildFromTemplate([
        {
            label: "electron",
            submenu: [
                { label: "sub-menu-label" },
                { label: "sub-menu-label" },
                { label: "sub-menu-label" },
            ]
        },
        {
            label: "edit",
            submenu: [
                { role: 'about' },
                { role: 'copy' },
                { role: 'redo' },
                { type: 'separator' },
                { role: 'hide' },
                { role: 'hideOthers' },
                { role: 'unhide' },
                { type: 'separator' },
                { role: 'quit' }
            ]
        },
        {
            label: "动作",
            submenu: [
                { label: "DevTools", role: "toggleDevTools" },
                { role: "togglefullscreen" },
                {
                    label: "Greet",
                    click: () => {
                        const answers = ["Yes", "No", "Maybe"]
                        dialog.showMessageBox({
                            title: "冉开林真帅",
                            message: "这也太帅了吧",
                            detail: "人为啥要长你这么帅啊" + ars,
                            buttons: answers
                        }).then(({ response }) => {
                            console.log(answers[response])
                            cb("Hello, electron.")
                        })
                    },
                    accelerator: "shift+command+h"
                }
            ]
        }]);
}
module.exports = mainMenu;
